package com.onetoall.yjt;

import android.animation.ObjectAnimator;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.animation.RotateAnimation;

/**
 * Created by DELL on 2016/12/9.
 */

public class SecondActivity extends Activity implements View.OnClickListener{

    private View mIv;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.layout_second_activity);
        mIv = findViewById(R.id.iv);
        mIv.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        rotateAnim(v);
    }
    private  void rotateRunAnim(View view){
//        Toast.makeText(this,"翻转点击",Toast.LENGTH_LONG).show();
        ObjectAnimator.ofFloat(view,View.TRANSLATION_X,-500,360).setDuration(1000).start();
    }

    private  void rotateAnim(View view){
//        Toast.makeText(this,"翻转点击",Toast.LENGTH_LONG).show();
        RotateAnimation rotateAnimation = new RotateAnimation
                (0f,360f,RotateAnimation.RELATIVE_TO_PARENT,
                        0.5f,RotateAnimation.RELATIVE_TO_PARENT,0.5f);
        rotateAnimation.setDuration(5000);
        view.startAnimation(rotateAnimation);
    }
}
